<template>
	<view>
		<view class="top-view">
			<uni-nav-bar backgroundColor="transparent" :shadow="false" :border="false" :statusBar="true" color="white">
			</uni-nav-bar>
		</view>
		<view class="container">

			<view class="info-row" @click="navToPersonalInformation">
				<image :src="info.fileName" class="avatar" />
				<view class="name-and-phone">
					<view class="name">{{info.headPeo || ''}}</view>
					<view class="phone">{{info.hospitalAme || ''}}</view>
				</view>
				<uni-icons type="right" color="#FFFFFF" />
			</view>

	<!-- 		<view class="statistics-card">
				<view class="item">
						<view class="num">175</view>
					<view class="name">全部订单</view>
				</view>
				<view class="item">
						<view class="num">90</view>
					<view class="name">待评估</view>
				</view>
				<view class="item">
						<view class="num">10294.00</view>
					<view class="name">总营收</view>
				</view>
			</view> -->

			<view class="card-view">
				<view class="row" @click="navToMineWallet">
					<image src="../../static/mine_bill.png"></image>
					<view class="title">订单</view>
					<uni-icons type="right" color="rgba(186, 189, 196,0.6)" />
				</view>
				<view class="row" @click="navToBillingDetail">
					<image src="../../static/mine_evaluate.png"></image>
					<view class="title">护士管理</view>
					<uni-icons type="right" color="rgba(186, 189, 196,0.6)" />
				</view>
			<!-- 	<view class="row">
					<image src="../../static/mine_evaluateme.png"></image>
					<view class="title">护士排行</view>
					<uni-icons type="right" color="rgba(186, 189, 196,0.6)" />
				</view> -->
			</view>

			<view class="exit-btn" @click="logout">退出账号</view>

		</view>

	</view>
</template>

<script>
	import * as hospitalInfo from '../../common/api/hospitalInfo.js'
	export default {
		data() {
			return {
				hospitalUid: '',
				info: {},
			}
		},
		onShow() {
			this.initInfo()
		},
		methods: {
			initInfo() {
				const dataJson = uni.getStorageSync('user_info') || '{}'
				const data = JSON.parse(dataJson) || {}
				this.hospitalUid = data.hospitalUid
				this.getInfo()
			},
			navToMineWallet() {
				uni.navigateTo({
					url: '/pages/chooseNurse/doctorOrder',
				})
			},
			navToBillingDetail() {
				uni.navigateTo({
					url: '/pages/chooseNurse/Nurse?hospitalUid=' + this.hospitalUid
				})
			},
			// navToEvaluateMe() {
			// 	uni.navigateTo({
			// 		url: '/pages/evaluateMe/evaluateMe'
			// 	})
			// },
			// navToMyEvaluate() {
			// 	uni.navigateTo({
			// 		url: '/pages/myEvaluate/myEvaluate'
			// 	})
			// },
			logout() {
				uni.showModal({
					title: '确认退出？',
					success: function(res) {
						if (res.confirm) {
							uni.removeStorageSync('user_info')
							uni.reLaunch({
								url: '/pages/login/login'
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				})
			},
			getInfo() {
				const param = {
					uid: this.hospitalUid
				}
				hospitalInfo.queryById(param).then(result => {
					this.info = result.data.data
				}).catch(error => {
					console.log(error);
				})
			},
			navToPersonalInformation() {
				uni.navigateTo({
					url: "/pages/personalInformation/personalInformation"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.top-view {
		height: 440rpx;
		background: linear-gradient(to right, rgba(46, 176, 217, 1), rgba(86, 213, 253, 0.61));
		border-bottom-left-radius: 50rpx;
		border-bottom-right-radius: 50rpx;
	}

	.container {
		margin-top: -250rpx;
		display: flex;
		flex-direction: column;

		.info-row {
			margin-left: 40rpx;
			margin-right: 40rpx;
			display: flex;
			align-items: center;

			.avatar {
				width: 108rpx;
				height: 108rpx;
				border-radius: 50%;
			}

			.name-and-phone {
				display: flex;
				flex-direction: column;
				margin-left: 20rpx;
				flex: 1;

				.name {
					color: #FFFFFF;
					font-size: 38rpx;
				}

				.phone {
					color: #FFFFFF;
					font-size: 26rpx;
					margin-top: 10rpx;
				}
			}
		}
	}

	.statistics-card {
		margin-left: 40rpx;
		margin-right: 40rpx;
		background: white;
		box-sizing: border-box;
		margin-top: 80rpx;
		border-radius: 24rpx;
		display: flex;
		height: 160rpx;

		.item {
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			width: 100%;
			height: 100%;

			.num {
				font-size: 36rpx;
				color: #232323;
				font-weight: bold;
			}

			.name {
				color: rgba(35, 35, 35, 0.5);
				font-size: 26rpx;
			}
		}
	}

	.card-view {
		margin-left: 40rpx;
		margin-right: 40rpx;
		background: white;
		padding: 10rpx 30rpx;
		box-sizing: border-box;
		margin-top: 32rpx;
		border-radius: 24rpx;

		.row {
			display: flex;
			align-items: center;
			height: 120rpx;

			image {
				width: 50rpx;
				height: 50rpx;
				border-radius: 50%;
			}

			.title {
				flex: 1;
				margin-left: 20rpx;
				color: #232323;
				font-size: 30rpx;
				font-weight: bold;
			}

			.right {
				display: flex;
				align-items: center;

				.name {
					color: rgba(35, 35, 35, 0.6);
					font-size: 24rpx;
				}

				.num {
					color: #232323;
					font-size: 34rpx;
					font-weight: bold;
					margin-left: 6rpx;
					margin-right: 12rpx;
				}
			}
		}
	}

	.exit-btn {
		margin-left: 40rpx;
		margin-right: 40rpx;
		height: 90rpx;
		background: white;
		border-radius: 20rpx;
		margin-top: 60rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		color: rgba(35, 35, 35, 0.7);
		font-size: 28rpx;
	}
</style>